package org.example.netty.test.nio.netty.chat.bean;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.example.netty.test.nio.netty.chat.common.MessageType;
import org.example.netty.test.nio.netty.chat.common.SystemId;

/**
 * @author zp
 * @version 1.0
 * @description: 注册信息类
 * @date 2023/4/6 18:51
 */
@Slf4j
@Data
public class RegisterMessage extends AbsMessageBase{
    private String userName;
    private String password;

    @Override
    public int getMessageType() {
        return MessageType.MESSAGE_TYPE_REGISTER;
    }

    /**
     * @description: 生成注册信息对象
     * @author zp
     * @date: 2023/4/7 19:32
     * @param userName
     * @param password
     * @return RegisterMessage
     */
    public static RegisterMessage buildRegister(String userName,String password){
        RegisterMessage registerMessage = new RegisterMessage();
        registerMessage.setUserName(userName);
        registerMessage.setPassword(password);
        registerMessage.setContent("注册用户");
        registerMessage.setSender(SystemId.SERVER_ID);
        registerMessage.setRecipient("99");
        return registerMessage;
    }
}
